package com.das.mechanic_alone.mvp.presenter.alone;


import com.das.mechanic_alone.mvp.contract.alone.X3NewAloneServiceContract;
import com.das.mechanic_base.base.X3BasePresenter;
import com.das.mechanic_base.bean.alone.NewServiceHeaderBean;
import com.das.mechanic_base.mapi.api.NetWorkHttp;
import com.das.mechanic_base.mapi.response.HttpCallBack;
import com.das.mechanic_base.mapi.schedulers.RxSchedulersHelper;

import java.util.List;

public class X3NewAloneServicePresenter extends X3BasePresenter<X3NewAloneServiceContract.View> implements X3NewAloneServiceContract.Presenter{

    @Override
    public void searchServiceByCarId(long carId, String keyword) {
        NetWorkHttp.getApi().searchServiceByCarId(carId,keyword)
                .compose(RxSchedulersHelper.defaultComposeRequest())
                .compose(mView.bindToLife())
                .subscribe(new HttpCallBack<List<NewServiceHeaderBean.AlreadyInPlanListBean>>() {
                    @Override
                    protected void onDone(List<NewServiceHeaderBean.AlreadyInPlanListBean> serviceHeaderBeans) {
                        mView.searchServiceByCarIdSus(serviceHeaderBeans);
                    }

                    @Override
                    protected String LoadingMessage() {
                        return null;
                    }

                    @Override
                    protected void showError(String error) {

                    }
                });
    }

//    @Override
//    public void saveDetectionService(List<AloneServiceListBean> mList) {
//        if (StringUtils.isListEmpty(mList)) {
//            mList = new ArrayList<>();
//        }
//        NetWorkHttp.getApi().saveDetectionServiceList(mList,mView.providerWorkBaseId())
//                .compose(mView.bindToLife())
//                .compose(RxSchedulersHelper.defaultComposeRequest())
//                .subscribe(new HttpCallBack<Object>() {
//                    @Override
//                    protected void onDone(Object o) {
//                        mView.searchAloneCache();
//                    }
//
//                    @Override
//                    protected String LoadingMessage() {
//                        return null;
//                    }
//
//                    @Override
//                    protected void showError(String error) {
//
//                    }
//                });
//    }


}
